package org.game.http
{
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	import flash.net.URLRequestMethod;
	
	/**
	 * @author 缺硒
	 */
	public class HttpService
	{
		private static var __instance:HttpService;
		
		private var _loader:URLLoader;
		
		public var callFunc:Function;
		
		public static function getInstance():HttpService
		{
			if(__instance == null)
				__instance = new HttpService(new Sington());
			return __instance;
		}
		
		public function HttpService(s:Sington)
		{
			_loader = new URLLoader();
			_loader.dataFormat = URLLoaderDataFormat.TEXT;
			_loader.addEventListener(Event.COMPLETE, completeHandler);
			
		}
		
		public function send():void
		{
			this.close();
			var request:URLRequest = new URLRequest("http://192.168.1.123/GameServer/compare");
			request.method	= URLRequestMethod.POST;
//			request.data	= 
			_loader.load(new URLRequest());
		}
		
		public function close():void
		{
			try{
				_loader.close();
			} catch(e:Error){}
		}
		
		// 收到数据
		private function completeHandler(evt:Event):void
		{
			trace(evt.target.data);
		}
		
	}
	//
}

class Sington{}